<template>
  <div class="home-container">
    <DynamicScrollImage image="https://static.zibovip.top/imgs/2025/06/257bbe9448e2b537.jpg" class="fixed-scroll-image" />
    <Header />
    <!-- <NavBar /> -->
    <div class="main-content">
      <CategoryMenu />
      <Banner />
      <UserCard />
    </div>
    <RecommendProducts />
    <Footer />
  </div>
</template>

<script setup lang="js">
import Header from '../components/Header.vue'
import NavBar from '@/components/NavBar.vue'
import CategoryMenu from '@/components/CategoryMenu.vue'
import Banner from '@/components/Banner.vue'
import UserCard from '@/components/UserCard.vue'
import RecommendProducts from '@/components/RecommendProducts.vue'
import Footer from '@/components/Footer.vue'
import { useUserStore } from '../store/user'
import DynamicScrollImage from '@/components/DynamicScrollImage.vue'

const userStore = useUserStore()
let token = userStore.token;
console.log("+++++++++"+token)
</script>

<style scoped>
.home-container {
  min-height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, #f8fafc 0%, #e0e7ff 100%);
  font-family: 'Segoe UI', 'PingFang SC', 'Hiragino Sans', 'Arial', sans-serif;
  color: #222;
  display: flex;
  flex-direction: column;
  position: relative;
}
.fixed-scroll-image {
  position: fixed;
  top: 120px;
  left: 0;
  z-index: 100;
}
.main-content {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: flex-start;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 0;
  box-sizing: border-box;
  gap: 0 18px;
}

.banner {
  width: 100%;
  max-width: 100vw;
  height: 400px;
  background: linear-gradient(120deg, #a18cd1 0%, #fbc2eb 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin: 0;
  padding: 0 24px;
  box-sizing: border-box;
}

.banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.2), transparent 70%);
  z-index: 1;
  pointer-events: none;
}

.banner-content {
  text-align: center;
  color: #fff;
  z-index: 2;
  max-width: 1200px;
  width: 100%;
  padding: 0 24px;
}

.banner-content h1 {
  font-size: 3.5rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  margin-bottom: 16px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  animation: fadeInUp 1s ease-out;
}

.banner-content p {
  font-size: 1.6rem;
  font-weight: 400;
  opacity: 0.9;
  animation: fadeInUp 1s ease-out 0.2s;
}

.recommend {
  max-width: 1200px;
  width: 100%;
  margin: 48px auto;
  padding: 0 24px;
  box-sizing: border-box;
}

.recommend h2 {
  font-size: 2.25rem;
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: 1px;
  text-align: center;
  color: #1e40af;
}

.product-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 24px;
  width: 100%;
  box-sizing: border-box;
}

:deep(.product-card) {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s cubic-bezier(0.4, 2, 0.6, 1), box-shadow 0.3s;
  cursor: pointer;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

:deep(.product-card):hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 12px 32px rgba(161, 140, 209, 0.2);
}

/* 动画效果 */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 响应式设计 */
@media (max-width: 1024px) {
  .banner {
    height: 300px;
  }
  .banner-content h1 {
    font-size: 2.5rem;
  }
  .banner-content p {
    font-size: 1.3rem;
  }
  .recommend {
    margin: 32px auto;
    padding: 0 16px;
  }
  .product-list {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
  }
  .main-content {
    flex-direction: column;
    align-items: stretch;
    gap: 16px 0;
  }
}

@media (max-width: 768px) {
  .banner {
    height: 220px;
  }
  .banner-content h1 {
    font-size: 2rem;
  }
  .banner-content p {
    font-size: 1.1rem;
  }
  .recommend h2 {
    font-size: 1.8rem;
  }
  .product-list {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .banner {
    height: 160px;
    padding: 0 16px;
  }
  .banner-content h1 {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }
  .banner-content p {
    font-size: 0.9rem;
  }
  .recommend {
    margin: 24px auto;
    padding: 0 12px;
  }
  .recommend h2 {
    font-size: 1.5rem;
  }
  .product-list {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  :deep(.product-card) {
    padding: 16px;
  }
}
</style>
